package com.guoheng.hazard.sys.controller.entpr;

import com.guoheng.hazard.common.base.Result;
import com.guoheng.hazard.sys.model.dto.entpr.CommitExaminationDTO;
import com.guoheng.hazard.sys.model.dto.entpr.DealExaminationDTO;
import com.guoheng.hazard.sys.service.entpr.EntprBasicExamineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;

/**
 * 类功能描述:　EntprBasicExamineController
 *
 * @author fbl
 * @date 2019-11-11 18:09
 */
@RestController
@Validated
@Api(value = "基本信息审核")
public class EntprBasicExamineController {

    @Resource
    EntprBasicExamineService entprBasicExamineService;

    @ApiOperation(value = "基本信息审核列表")
    @GetMapping(value = "data/basic/enterprise/examinations")
    public Result getExaminations(Long entprId,@RequestParam(value = "pageNum") Integer pageNum, @RequestParam(value = "pageSize") Integer pageSize,String entprName,Integer reviewStatus) {
        return entprBasicExamineService.getExaminations(entprId,pageNum, pageSize,entprName,reviewStatus);
    }

    @ApiOperation(value = "提交审核")
    @PostMapping(value = "data/basic/enterprise/examination")
    public Result commitExamination(@RequestBody @Valid CommitExaminationDTO commitExaminationDTO) {
        return entprBasicExamineService.commitExamination(commitExaminationDTO);
    }

    @ApiOperation(value = "处理审核")
    @PutMapping(value = "data/basic/enterprise/examination/{id}")
    public Result dealExamination(@PathVariable @NotNull @Positive Long id,@RequestBody @Valid DealExaminationDTO dealExaminationDTO) {
        return entprBasicExamineService.dealExamination(id,dealExaminationDTO);
    }

    @ApiOperation(value = "查询审核详情")
    @GetMapping(value = "data/basic/enterprise/examination/{id}")
    public Result getExaminationDetail(@PathVariable @NotNull @Positive Long id) {
        return entprBasicExamineService.getExaminationDetail(id);
    }

}